/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.comut.crud.pojo.driver;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author asantos
 */
@XmlRootElement()
@XmlAccessorType(XmlAccessType.FIELD)
public class Driver implements Serializable {

    private static final long serialVersionUID = 123235;
    private int id = -1;
    private String dr_code = null;
    private int type = -1;
    private String issuing_authority = null;
    private int issuing_state = -1;
    private String issue_date = null;
    private String card_validation_date_begin = null;
    private String card_validation_date_end = null;
    private String ibutton = null;
    private Driver_group dr_grp = null;

    public String getCard_validation_date_begin() {
        return card_validation_date_begin;
    }

    public void setCard_validation_date_begin(String card_validation_date_begin) {
        this.card_validation_date_begin = card_validation_date_begin;
    }

    public String getCard_validation_date_end() {
        return card_validation_date_end;
    }

    public void setCard_validation_date_end(String card_validation_date_end) {
        this.card_validation_date_end = card_validation_date_end;
    }

    public String getDr_code() {
        return dr_code;
    }

    public void setDr_code(String dr_code) {
        this.dr_code = dr_code;
    }

    public String getIbutton() {
        return ibutton;
    }

    public void setIbutton(String ibutton) {
        this.ibutton = ibutton;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getIssue_date() {
        return issue_date;
    }

    public void setIssue_date(String issue_date) {
        this.issue_date = issue_date;
    }

    public String getIssuing_authority() {
        return issuing_authority;
    }

    public void setIssuing_authority(String issuing_authority) {
        this.issuing_authority = issuing_authority;
    }

    public int getIssuing_state() {
        return issuing_state;
    }

    public void setIssuing_state(int issuing_state) {
        this.issuing_state = issuing_state;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Driver_group getDr_grp() {
        return dr_grp;
    }

    public void setDr_grp(Driver_group dr_grp) {
        this.dr_grp = dr_grp;
    }

    @Override
    public String toString() {
        return "Driver{" + "id=" + id + ", dr_code=" + dr_code + ", type=" + type + ", issuing_authority=" + issuing_authority + ", issuing_state=" + issuing_state + ", issue_date=" + issue_date + ", card_validation_date_begin=" + card_validation_date_begin + ", card_validation_date_end=" + card_validation_date_end + ", ibutton=" + ibutton + ", dr_grp=" + dr_grp + '}';
    }

    public boolean isValid() {
        if (dr_code != null) {
            if (dr_grp != null) {
                if(dr_grp.getId_group()==-1){
                    return false;
                }
                else{
                    return true;
                }
            } else {
                return true;
            }
        } else {
            return false;
        }
    }
}
